package com.sk.coin.sys.service.impl;

import com.sk.coin.sys.entity.SysMenu;
import com.sk.coin.sys.mapper.SysMenuMapper;
import com.sk.coin.sys.service.ISysMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sk.coin.sys.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统菜单 服务实现类
 * </p>
 *
 * @author Administrator
 * @since 2022-02-21
 */
@Service
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {

    @Autowired
    private ISysRoleService sysRoleService;

    @Override
    public List<SysMenu> getMenuByUserId(Long userId) {
        if (sysRoleService.isSuperAdmin(userId)) {
            return list();
        }
        return baseMapper.selectMenusByUserId(userId);
    }
}
